<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateMomentTable extends Migration
{
    /**
     * 发布动态
     */
    public function up(): void
    {
        Schema::create('moment', function (Blueprint $table) {
            $table->increments('id')->comment('动态ID');
            $table->integer('user_id')->default(0)->comment('发布者用户ID');
            $table->tinyInteger('user_gender')->default(-1)->comment('发布者用户性别');
            $table->string('words', 1000)->default('')->comment('动态文字');
            $table->string('images', 500)->default('')->comment('动态图片');
            $table->string('voice', 100)->default('')->comment('动态语音');
            $table->integer('like_num')->default(0)->comment('点赞数');
            $table->integer('comment_num')->default(0)->comment('评论数');
            $table->timestamps();
            $table->tinyInteger('status')->default(1)->comment('状态');
            $table->integer('is_top')->default(0)->comment('是否推荐置顶');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('moment');
    }
}
